
 begintownscript;

 variables;

 int i,j,k,r1,choice;

 body;

 beginstate INIT_STATE;

	add_char_to_group(7,1);
	add_char_to_group(8,1);
	add_char_to_group(9,1);
	add_char_to_group(10,1);
	add_char_to_group(11,1);

break;

 beginstate START_STATE;

break;
		
 beginstate EXIT_STATE;

break;

 beginstate 10;
	if (get_flag(11,1) == 0) {
		print_str_color("A flock of bats drop out from the cave ceiling!",2);
		set_flag(11,1,1);
		activate_hidden_group(1);
}
break;

 beginstate 11;
	if (get_flag(11,2) == 0) {
		print_str_color("A flock of bats drop out from the cave ceiling!",2);
		set_flag(11,2,1);
		activate_hidden_group(2);
}
break;

 beginstate 12;
	if (get_flag(11,3) == 0) {
		message_dialog("Suddenly you hear a horrible moaning sound emitting from within the caverns. It is unlike anything you've ever heard. It is like the sound of thousands of babies and demons screaming all at once.","The scream only lasted for a few seconds, but it did nonetheless send shivers down your spine. What kind of beast could make that sound?");
		set_flag(11,3,1);
}
	if ((get_flag(11,3) > 0) && (get_flag(11,3) < 6) && (char_ok(6) == TRUE)) {
		print_str_color("You hear a terrifying scream.",2);
		inc_flag(11,3,1);
}
	if ((get_flag(11,3) >= 6) && (char_ok(6) == TRUE)) {
		print_str_color("The screaming is getting on your nerves. It's hard to remain calm.",2);
		i = random_party_member();
		set_char_status(i,20,5,0,1);
}
break;

 beginstate 13;
	if (get_flag(11,4) == 0)
		message_dialog("You look closely at the walls to the west. You make out moss covered cave drawings. They must be hundreds of years old. The drawings are mostly of deer or wolves. This cave must have been the home of a primitive tribe.","Long time ago.");
		set_flag(11,4,1);
 break;
	